<template>
  <div class="outline-parent">
    <div class="flex-box border-hover-style">
      <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
      </t-image-viewer>
      <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
      </van-image-preview>
      <div class="Showroom-parent" v-if="props.info.digitalShowroom">
        <digitalShowroomInfo :url="props.info.digitalShowroom" :id="props.info.id" />
      </div>
      <img
        class="outline-parent-bg"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
        :src="publicUrls + 'free/style8/Level3outlineStyle3Bg.webp'"
        alt=""
      />
      <img class="outline-parent-bg" v-else :src="publicUrls + 'free/style8/Level3outlineStyle3Bg2.webp'" alt="" />
      <div class="outline">
        <div class="outline-cover" v-if="props.info.subTitle || props.info.value || props.info.remarks">
          <img
            class="coverbg"
            @click="ImgVisible = true"
            :src="publicUrls + 'free/style8/Level3outlineImg.webp'"
            alt=""
          />
          <div
            class="outline-title outline-title2"
            v-if="!props.info.value && props.info.text?.length > 10"
            v-html="textType(props.info.text)"
          ></div>
          <div class="outline-title outline-title2" v-else-if="!props.info.value">{{ props.info.text }}</div>
          <img
            v-if="props.info.value"
            class="coverHover"
            @click="ImgVisible = props.info.value ? true : false"
            :src="urls + props.info.value + '?imageView2/3/w/898/h/460/format/webp'"
            alt=""
          />
          <img
            v-else
            class="coverImg"
            @click="ImgVisible = true"
            :src="publicUrls + 'free/style8/Level3outlineImgNull.webp'"
            alt=""
          />
        </div>
        <div class="outline-cover2" v-else>
          <img
            class="coverbg"
            @click="ImgVisible = true"
            :src="publicUrls + 'free/style8/Level3outlineImg.webp'"
            alt=""
          />
          <div class="outline-title outline-title2" v-if="!props.info.value" v-html="textType(props.info.text)"></div>
          <img
            class="coverImg"
            @click="ImgVisible = true"
            :src="publicUrls + 'free/style8/Level3outlineImgNull.webp'"
            alt=""
          />
        </div>
        <div
          class="outline-content"
          v-if="props.info.subTitle || props.info.value || props.info.remarks"
          :style="!props.info.remarks && !props.info.value && { justifyContent: 'center' }"
        >
          <div class="outline-title" v-if="props.info.value" v-html="textType(props.info.text)"></div>
          <p class="outline-subTitle" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>
          <div class="line" :style="props.info.subTitle && { marginTop: '0' }"></div>
          <TextMax
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :infoData="props.info"
            :row="props.info.value ? 5 : 7"
          ></TextMax>
          <div class="line line2" v-if="!props.info.subTitle"></div>
        </div>
      </div>
    </div>
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'free8Style3',
});
</script>

<script setup lang="ts">
import { publicUrls, textType } from '@/utils/minxin';
import digitalShowroomInfo from '@/freeComponents/unitdigitalShowroom/style8.vue';
import textMode from '../../../textMode/textMode.vue';
import { urls } from '@/utils/request/upload';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { defineComponent, ref } from 'vue';
import { useProjectStore } from '@/store';
const store = useProjectStore();

const ImgVisible = ref(false);

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style scoped lang="less">
.outline-parent {
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  margin-right: 140px;
  margin-left: 40px;
}
.Showroom-parent {
  width: 50px;
  height: 50px;
  object-fit: contain;
  position: absolute;
  bottom: 30px;
  left: 48%;
  transform: translate(-48%, 0);
  z-index: 21;
}
.flex-box {
  width: 380px;
  height: 684px;
  display: flex;
  flex-direction: column;
  justify-content: start;
  position: relative;
  padding: 18px 26px 116px 16px;
  z-index: 20;
  overflow: hidden;
}

.outline-parent-bg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
.outline {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  z-index: 22;
}
.outline-cover2 {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 32px;
  .coverbg {
    width: 100%;
    height: 182px;
    position: absolute;
    top: 199px;
    left: 0;
    z-index: 12;
  }
  .coverImg {
    width: 100%;
    height: 182px;
  }
  .outline-title2 {
    top: 53%;
    transform: translate(-50%, -53%);
  }
}
.outline-cover {
  width: 100%;
  height: 182px;
  margin-bottom: 40px;
  overflow: hidden;
  background: rgba(222, 217, 211, 0.5);
  flex-shrink: 0;
  position: relative;
  &:hover .coverHover {
    transform: scale(1.2);
  }
  .coverHover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
  }
  .coverbg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 12;
  }
}
.outline-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
}
.outline-title2 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  ::v-deep p {
    color: #f1ecdf !important;
  }
}
.outline-title {
  width: 100%;
  margin-bottom: 16px;
  font-family: 'SourceHanSerifCN-Bold';
  font-size: 22px;
  color: #f1ecdf;
  line-height: 34px;
  text-align: center;
  ::v-deep p {
    font-family: 'SourceHanSerifCN-Bold';
    font-size: 22px;
    color: #4f6e5c;
    line-height: 34px;
    text-align: center;
  }
}
.outline-subTitle {
  width: 270px;
  font-family: SourceHanSerifCN;
  font-size: 18px;
  color: #4f6e5c;
  line-height: 24px;
  text-align: center;
  opacity: 0.5;
  margin-bottom: 24px;
}
.line {
  width: 270px;
  height: 1px;
  background: rgba(79, 110, 92, 1);
  margin-bottom: 24px;
  margin-top: 32px;
  flex-shrink: 0;
}
.line2 {
  margin-top: 24px;
}
::v-deep .textMore-box {
  width: 270px;
  flex: 1;
  flex-shrink: 0;
}
::v-deep .van-text-ellipsis {
  font-family: PingFangSC !important;
  font-size: 16px !important;
  color: rgba(0, 0, 0, 0.59) !important;
  line-height: 32px !important;
}
::v-deep .van-text-ellipsis__action::before {
  color: #345746 !important;
  font-weight: 400 !important;
  text-decoration-line: underline;
}
</style>